package com.itheima.web;

import com.itheima.dto.CheckGroupDto;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.pojo.CheckGroup;
import com.itheima.service.CheckGroupService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/checkgroup")
public class CheckGroupController {

    @Reference
    private CheckGroupService checkGroupService;

    @GetMapping("/findAll")
    public List<CheckGroup> findAll(){
        return checkGroupService.findAll();
    }


    //检查项添加
    @PostMapping("/addOrUpdate")
    public void addOrUpdate(@RequestBody CheckGroupDto checkGroup){
        checkGroupService.addOrUpdate(checkGroup);
    }

    //分页显示数据
    @RequestMapping("/findByPage")
    public PageResult findByPage(@RequestBody QueryPageBean pageBean){

        return checkGroupService.findByPage(pageBean);
    }
    //逻辑删除
    @RequestMapping("/deleteById/{id}")
    public Boolean deleteById(@PathVariable("id") Long id){
        return checkGroupService.deleteById(id);
    }
}
